/**Haidy Essam*/
package models;

import java.util.Calendar;
import java.util.Date;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OrderColumn;

import play.db.jpa.Model;

@Entity
public class editVersion extends Model {

	public String Title;

	@Lob
	public String content;
	public String Stringofwords;
	public String ExpLevel;
	@ManyToOne
	@JoinColumn(name = "TutorialNumber")
	public Tutorial tutEdits;
	public Date editDate = new Date();

	/**
	 * The constructor of the editVersion class. Creates new edit version of the
	 * Tutorials.
	 * 
	 * @author Haidy Essam
	 * @param title
	 *            , tutorialid, content, words, Exp
	 */
	public editVersion(long tutorialid, String Title, String content,
			String Stringofwords, String ExpLevel) {
		this.Title = Title;
		this.content = content;
		this.Stringofwords = Stringofwords;
		this.ExpLevel = ExpLevel;
		tutEdits = Tutorial.findById(tutorialid);
		this.editDate = Calendar.getInstance().getTime();
	}

	public String getTitle() {
		return Title;
	}

	public void setTitle(String title) {
		Title = title;
		this.save();
	}

	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
		// this.save();
	}

	public String getStringofwords() {
		return Stringofwords;
	}

	public void setStringofwords(String stringofwords) {
		Stringofwords = stringofwords;
		this.save();
	}

	public String getExpLevel() {
		return ExpLevel;
	}

	public void setExpLevel(String expLevel) {
		ExpLevel = expLevel;
		this.save();
	}

	public Tutorial getTutEdits() {
		return tutEdits;
	}

	public void setTutEdits(Tutorial tutEdits) {
		this.tutEdits = tutEdits;
	}

	public Date getEditDate() {
		return editDate;
	}

	public void setEditDate(Date editDate) {
		this.editDate = editDate;
	}

}
